using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Entities;
using Unity.Transforms;
using UnityEngine;

public class PlayerShootingManager : MonoBehaviour
{
    public static PlayerShootingManager Instance { get; private set; }

    [SerializeField] private GameObject ShootPopupPrefab;

    private void Awake()
    {
        Instance = this;
    }

    /*
    private void Start()
    {
        PlayerShootingSystem playerShootingSystem =
            World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged<PlayerShootingSystem>();
        playerShootingSystem.OnShoot += OnShoot;
    }

    private void OnShoot(object sender, EventArgs args)
    {
        Entity playerEntity = (Entity)sender;
        LocalTransform localTransform =
            World.DefaultGameObjectInjectionWorld.EntityManager.GetComponentData<LocalTransform>(playerEntity);
        Instantiate(ShootPopupPrefab, localTransform.Position, Quaternion.identity);
    }
    */

    public void PlayerShoot(Vector3 playerPosition)
    {
        Instantiate(ShootPopupPrefab, playerPosition, Quaternion.identity);
    }
}
